import { $JiessDialog } from '@/.jiess';
import { JiessComponent } from '@/jiessConfig';
import React, { ReactNode } from 'react';
// 运行时配置
// 全局初始化数据配置，用于 Layout 用户信息和权限初始化
// 更多信息见文档：https://umijs.org/docs/api/runtime-config#getinitialstate
export async function getInitialState(): Promise<{ name: string }> {
  return { name: '@umijs/max' };
}
export function rootContainer(container: ReactNode) {
  return React.createElement(
    'div',
    null,
    React.createElement(JiessComponent, {
      setup(this: any) {
        // 注册全局弹框
        this.add(this.render({ is: $JiessDialog }));
      },
    }),
    container,
  );
}

export const layout = () => {
  return {
    logo: 'https://img.alicdn.com/tfs/TB1YHEpwUT1gK0jSZFhXXaAtVXa-28-27.svg',
    menu: { locale: false },
  };
};
